package com.example.concurrent;

import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "c.test8locks")
public class Test8Locks {
	public static void main(String[] args) {
		Number n1 = new Number();
		new Thread( ()-> {
			log.debug("begin");
			try {
				n1.a();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}).start();
		new Thread( ()-> {
			log.debug("begin");
			n1.b();
		}).start();
		new Thread( ()-> {
			log.debug("begin");
			n1.c();
		}).start();
	}
}
@Slf4j(topic = "c.number")
class Number{
	public synchronized void a() throws InterruptedException {
		Thread.sleep(1000);
		log.debug("1");
	}
	public synchronized void b() {
		log.debug("2");
	}
	public void c() {
		log.debug("3");
	}
}
